# -*- coding: utf-8 -*-
from django.contrib.gis.db import models

class Tag(models.Model):
    name = models.CharField(max_length=100)
    description = models.TextField()
    geo = models.PointField()
    objects = models.GeoManager()
    
    def __unicode__(self):
        return "[%s] %s" % (self.code, self.name)


class WMSBasemap(models.Model):
    name = models.CharField(max_length=100,default="metacarta")
    url = models.URLField(verify_exists=True,max_length=200,
        default="http://labs.metacarta.com/wms/vmap0")
    layers = models.CharField(max_length=100,default="basic")
    
    def __unicode__(self):
        return "%s" % self.name


# TinyMCE Integration

class TinyMCE_Image(models.Model):
    name = models.CharField(max_length=150)
    image = models.ImageField(upload_to="tiny_mce/images/")
    
    def __unicode__(self):
        return self.name


class TinyMCE_Multimedia(models.Model):
    name = models.CharField(max_length=150)
    file = models.FileField(upload_to="tiny_mce/media/")
    
    def __unicode__(self):
        return self.name
    
    class Meta:
        verbose_name = "[Resources] Media File"
        verbose_name_plural = "[Resources] Media Files"
    
    
class TinyMCE_Link(models.Model):
    name = models.CharField(max_length=150)
    url = models.URLField()
    
    def __unicode__(self):
        return self.name
    
    class Meta:
        verbose_name = "[Resources] Link"
        verbose_name_plural = "[Resources] Links"
    

class TinyMCE_Template(models.Model):
    name = models.CharField(max_length=150)
    file = models.FileField(upload_to="tiny_mce/templetes/")
    description = models.CharField(max_length=200)
    
    def __unicode__(self):
        return self.name
    
    class Meta:
        verbose_name = "[Resources] Template"
        verbose_name_plural = "[Resources] Templates"
    
    
class TinyMCE_File(models.Model):
    name = models.CharField(max_length=150)
    file = models.FileField(upload_to="tiny_mce/files/")
    
    def __unicode__(self):
        return self.name
    
    class Meta:
        verbose_name = "[Resources] File"
        verbose_name_plural = "[Resources] Files"
